/**
 * Created by Administrator on 2016/9/23.
 */

(function ($) {
    $(function(){

        var oSou= $(".sou"),
            oJia= $(".jia"),
            iIdenx6=0;

        oSou.mouseenter(function(){
            iIdenx6=oSou.index($(this));

            oSou.css({borderColor:"#ccc",color:"#333"}).eq(iIdenx6).css({borderColor:"red",color:"red"});
        });
        oSou.mouseleave(function(){
            oSou.css({borderColor:"#ccc",color:"#333"});
        });
        oJia.mouseenter(function(){
            iIdenx6=oJia.index($(this));
            oJia.animate({opacity:".8",filter:"alpha(opacity=80)"}).eq(iIdenx6).animate({opacity:".6",filter:"alpha(opacity=60)"});
        });
        oJia.mouseleave(function(){
            oJia.animate({opacity:".8",filter:"alpha(opacity=80)"});
        });


        //放大镜
        var
            oFle= $(".f-le a"),
            oFri = $(".f-ri a"),
            oUlic = $(".ulict"),
            oUli = $(".ulict li"),
            oTtpp = $(".bottom-left .tpp"),
            oTMo = $(".tpp .mo"),
            oTtp = $(".tpp li"),
            oRight =$(".right-Img"),
            oRightImg =$(".right-Img li"),
            oRightmg = $(".right-Img img"),
            iIndex1=0;

        oFri.click(function(){
            oUlic.animate({left:"-75px"})
        });
        oFle.click(function(){
            oUlic.animate({left:"25px"})
        });
        oUli.mouseenter(function(){
            iIndex1=$(this).index();
            oUli.removeClass("Img-li").eq(iIndex1).addClass("Img-li");
            oTtp.removeClass("bap").eq(iIndex1).addClass("bap");
            oRightImg.removeClass("lipt").eq(iIndex1).addClass("lipt");
        });
        oTtpp.mouseenter(function(){
            oTMo.css({display:"block"});
            oRight.css({display:"block"});
        });
        oTtpp.mouseleave(function(){
            oTMo.css({display:"none"});
            oRight.css({display:"none"});
        });

        var
            oMoW= parseInt(oTMo.css("width")),
            oTppW= parseInt(oTtpp.css("width")),
            oMoH= parseInt(oTMo.css("height")),
            oTppH= parseInt(oTtpp.css("height")),
            oMax=oTppW-oMoW,
            oMay=oTppH-oMoH;

        oTtpp.mousemove(function(evt){
            var event= evt||window.event;
            var pointx= event.pageX-oTtpp.offset().left-(oMoW/2);
            var pointy= event.pageY-oTtpp.offset().top-(oMoH/2);


            if(pointx<0) {
                pointx = 0;
            }
            if(pointx > oMax) {
                pointx = oMax;
            }
            if(pointy<0) {
                pointy = 0;
            }
            if(pointy>oMay) {
                pointy = oMay;
            }
            oTMo.css({left:pointx,top:pointy});
            oRightmg.css({left:-3*pointx,top:-3*pointy});


        });
        //点击

          var sElectz= $(".set option"),
              sElect= $(".det .selp"),
              sElect1= $(".det .selp2"),
              sElect2= $(".det .selp3");

          $(".wanmei").mouseenter(function(){
              $(".det").css({display:"block"});
          })
          $(".wanmei").mouseleave(function(){

              $(".det").css({display:"none"});

        })

        var

            oBtShop= $(".bot-right .tan"),
            oBtA= $(".centerp4 .jia"),
            iIdex4= 0,
            iTimerq = 0;
        oBtA.on("click",function(){

            iIdex4=oBtA.index($(this));
            iTimerq=setTimeout(function(){
                oBtShop.css({display:"none"}).eq(iIdex4).css({display:"block"});
                oBtShop.css({opacity:"0"}).eq(iIdex4).animate({opacity:"1"});
            },2000);

            iTimerq=setTimeout(function(){
                oBtShop.eq(iIdex4).css({display:"none"});
                oBtShop.eq(iIdex4).animate({opacity:"0"});
            },5000);
        });

        $(".fotbtm-left p").mouseenter(function(){
            $(".fotbtm-left .apa").css({color:"#e60000"});
        })
        $(".fotbtm-left p").mouseleave(function(){
            $(".fotbtm-left .apa").css({color:"#222"});
        })


        var iIndex6= 0,
            oPa=$(".fotbtm-left .pa");
        oPa.mouseenter(function(){
            iIndex6=oPa.index($(this));
            oPa.css({color:"#222",background:"#fff"}).eq(iIndex6).css({color:"#fff",background:"#e60000"})
        });
        oPa.mouseleave(function(){
            iIndex6=oPa.index($(this));
            oPa.css({color:"#222",background:"#fff"})
        })
    //评论切换
        var oFtp= $(".ft-tp a"),
            oFtpL= $(".ft-tp li"),
            oFtpt= $(".divone .dit"),
            oFtpt2= $(".divone .dit2"),
            oPj2= $(".ft-btt .pj"),
            iInDex=0;

        oFtp.click(function(){
            iInDex=oFtp.index($(this));

            oFtp.removeClass("lct1").eq(iInDex).addClass("lct1");
            oFtpL.removeClass("lipe").eq(iInDex).addClass("lipe");
            if(iInDex==0){
                oFtpt.css({display:"block"})
            }else if(iInDex==1){
                oFtpt2.css({display:"block"});
                oFtpt.css({display:"none"});
            }else if(iInDex==4){
                oFtpt2.css({display:"none"});
                oFtpt.css({display:"none"});
                oPj2.css({display:"none"});
            }else{
                oPj2.css({display:"block"});
                oFtpt.css({display:"none"});
                oFtpt2.css({display:"none"});
            }


        });




        var oBotA= $(".bot-tl3 a"),
            InDex=0;
        oBotA.mouseenter(function(){
            InDex=$(this).index();

            oBotA.eq(InDex).css({
                borderColor:"#e60000",color:"#fff",background:"#e60000"
            })

        })
        oBotA.mouseleave(function(){
            if(InDex==1){
                oBotA.eq(InDex).css({
                    borderColor:"#e60000",color:"#fff",background:"#e60000"
                })
            }else{
                oBotA.eq(InDex).css({
                    borderColor:"#ccc",color:"#222",background:"#fff"
                })
            }
        })

        var
            oPjC=$(".pj-cont i"),
            oPjCe= $(".pj-cont i em"),
            oPj= $(".ft-btt .pj"),
            oPjbot = $(".pj .pj-bot2"),
            iIdenX9=0;

        oPjC.click(function(){
            iIdenX9=oPjC.index($(this));
            if(iIdenX9<2){
              oPjCe.css({zIndex:"-1"}).eq(iIdenX9).css({zIndex:"5"});
              oPj.css({height:"600px"})
              oPjbot.css({display:"block"})
           }else{
                oPjCe.css({zIndex:"-1"}).eq(iIdenX9).css({zIndex:"5"});
                oPj.css({height:"291px"})
                oPjbot.css({display:"none"})
            }
        })



    });

})(jQuery)